<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">专题列表</a></li>
        <li><a href="{:U('Adminsubject/edit_subject')}" target="_self">添加专题</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Adminsubject/subject_lists')}">
        关键字：
        <input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword|default=''}" placeholder="请输入关键字...">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:U('Adminsubject/subject_lists')}">清空</a>
    </form>

        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="50">排序</th>
                <th width="50">ID</th>
                <th>标题</th>
                <th width="150">修改时间</th>
                <th width="150">发布时间</th>
                <th width="50">状态</th>
                <th width="70">操作</th>
            </tr>
            </thead>
            <foreach name="lists" item="vo">
                <tr>
                    <td><input data-id="{$vo.id}" class="input input-order" type="text" size="5" value="{$vo.sort}"></td>
                    <td>{$vo.id}</td>
                    <td>{$vo.name}</td>
                    <td>{:date('Y-m-d H:i:s', $vo['updated_at'])}</td>
                    <td>{:date('Y-m-d H:i:s', $vo['created_at'])}</td>
                    <td>
                        <php>$status = array('0' => '隐藏', '1' => '显示')</php>
                        {$status[$vo['status']]}
                    </td>
                    <td>
                        <a href="{:U('Adminsubject/edit_subject', array('id' => $vo['id']))}">编辑</a> |
                        <a href="{:U('Adminsubject/edit_subject', array('id' => $vo['id'], 'del' => 1))}" class="js-ajax-delete">删除</a>
                    </td>
                </tr>
            </foreach>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $(document).ready(function () {
        $('body').delegate('.input-order', 'change', function () {
            var order 	= $(this).val();
            var id 		= $(this).attr('data-id');
            $.get("{:U('Portal/Adminsubject/change_subject_order')}", {id : id, order : order}, function (data) {
                if (data.status) {
                    window.location.reload();
                }
            })
        })
    })
</script>
</body>
</html>